<template>
    <div>
        <van-field type="text" label="用户名" placeholder="请输入用户名" v-model="username"/>
        <van-field type="password" label="密码" placeholder="请输入密码" v-model="password"/>
        <van-button type="primary" @click="adduser">注册</van-button>
    </div>
</template>

<script>
export default {
   data () {
      return {
          username:'',password:''
      };
   },

    methods: {
        adduser:function(){
            this.axios.post(this.localhost+'login2/',this.qs.stringify({username:this.username,password:this.password}))
            .then(res=>{
                console.log(res);
                if (res.data.code == 200){
                    this.$toast.success(res.data.meg)
                }else{
                    this.$toast.fail(res.data.meg)
                }
            })
        }
       },

    computed: {

       },

    created () {

       },

    mounted() {

       },

    components: {

       }
}
</script>
<style lang='css' scoped>

</style>